package core 
{
	import cn.inswf.describe.Description;
	import cn.inswf.describe.Metadata;
	import cn.inswf.framework.mvcs.Actor;
	import event.ViewEvent;
	
	/**
	 * ...
	 * @author liwei
	 */
	public class Mediator extends Actor 
	{
		
		public function Mediator() 
		{
			super();
			
		}
		override public function onRegister():void 
		{
			var desc:Description=Description.getDescription(this);
			var list:Array=desc.getMeta("view");
			if(list==null){
				return;
			}
			var len:int=list.length;
			while(len--){
				var meta:Metadata=list[len];
				var view:ViewBase=this[meta.desc.name];
				view.addEventListener(ViewEvent.INIT, inithandler);
			}
		}
		protected function viewInit():void {
			
		}
		
		private function inithandler(e:ViewEvent):void 
		{
			viewInit();
		}
	}

}